package com.zzti.serviceImpl;


import com.sun.istack.internal.logging.Logger;
import com.zzti.mapper.OrderEquMapper;
import com.zzti.pojo.OrderEqu;
import com.zzti.service.OrderEquServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class OrderEquServerImpl implements OrderEquServer {

    private static Logger log = Logger.getLogger(OrderEquServerImpl.class);

    @Autowired
    private OrderEquMapper orderEquMapper;

    @Override
    public int[] selectByTime() {
        int[] arr = new int[12];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = 0;
        }
        List<OrderEqu> ls = orderEquMapper.selectByTime();
        System.out.println(ls);
        for (OrderEqu or : ls) {
            int hours = or.getCreateTime().getHours();
            arr[hours / 2]++;
        }
        return arr;
    }
}
